package org.goldenport.g3.drivers

import org.goldenport.g3._
import org.goldenport.g3.messages._
import org.goldenport.g3.messages.datastore._
import org.goldenport.g3.messages.sql.VARCHAR

/**
 * @since   Sep. 30, 2010
 * @version Sep. 30, 2010
 * @version Dec.  4, 2011
 * @author  ASAMI, Tomoharu
 */
class AppEngineDataStoreTester extends G3Application with UseRecord {
  val KIND_NAME = 'datastorespec
  val schema = Schema(
    IdField,
    Field('name, XString),
    'zip,
    ('address, XString),
    ('phone, XToken, MZeroMore),
    ('comment, XString, Property(VARCHAR(2048))))

  datastore('appds)

  val create = Create(KIND_NAME, schema)

  val insert = Insert(
    KIND_NAME,
    Record('id -> 5, 'name -> "Yamada Taro",
           'zip -> "1234567", 'address -> "Yokohama",
           'phone -> "0451234567", 'comment -> "omlet rice"))

  port("/create") agents(create) invoke("appds")
  port("/insert") agents(insert) invoke("appds")
}
